﻿using DtoFw;
using DtoFw.Interface;
using DtoFw.Query;
using DtoFw.Result;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SceneEvidenceAPISDK
{
    public class ApiMenu : Base, IMenu
    {
        /// <summary>
        /// 移除
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public BaseResult Delete(DeleteDto query)
        {
            return HttpTools.Delete<BaseResult>(
                query, base.GetApiRouter("Delete"));
        }
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public BaseGenericResult<Pager<MenuInfoResult>> GetPager(MenuQuery query)
        {
            return HttpTools.Get<BaseGenericResult<Pager<MenuInfoResult>>>(
                 query, base.GetApiRouter("GetPager"));
        }
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public BaseResult Post(MenuInfo info)
        {
            return HttpTools.Post<BaseResult>(info, base.GetApiRouter("Post"));
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public BaseResult Put(MenuEditInfo info)
        {
            return HttpTools.Put<BaseResult>(info, base.GetApiRouter("Put"));
        }
        /// <summary>
        /// 查询单个
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public BaseGenericResult<MenuEditInfo> QueryModel(long Id)
        {
            return HttpTools.Get<BaseGenericResult<MenuEditInfo>>(base.GetApiRouter("QueryModel", Id.ToString()));
        }
        /// <summary>
        /// 查询角色菜单
        /// </summary>
        /// <param name="RoleId"></param>
        /// <returns></returns>
        public BaseGenericResult<List<RoleMenuResult>> QueryRoleMenus(long roleId = 0)
        {
            return HttpTools.Get<BaseGenericResult<List<RoleMenuResult>>>(base.GetApiRouter("QueryRoleMenus",
                roleId.ToString()));
        }
        /// <summary>
        /// 根据级别查询
        /// </summary>
        /// <param name="level"></param>
        /// <returns></returns>
        public BaseGenericResult<List<MenuLevelResult>> QueryToLevel(int level = 0)
        {
            return HttpTools.Get<BaseGenericResult<List<MenuLevelResult>>>(base.GetApiRouter("QueryToLevel",
                level.ToString()));
        }
    }
}
